package com.cn.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cn.controller.AdvController;
import com.cn.exception.BusinessException;
import com.cn.mapper.AdvMapper;
import com.cn.pojo.Adv;
import com.cn.response.ResultCode;
import com.cn.service.AdvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdvServiceImpl extends ServiceImpl<AdvMapper, Adv> implements AdvService {

    @Autowired
    AdvMapper advMapper;

    @Override
    public Page<Adv> selectAll(Page page, String advTitle, Integer statusId) {
        List<Adv> advList=this.advMapper.selectAll(advTitle,statusId,page);
        page.setRecords(advList);
        return page;
    }

    @Override
    public Integer getDeleteById(Integer id) {
        return this.baseMapper.deleteById(id);
    }

    @Override
    public Integer getUpdateById( Adv adv) {
        return this.baseMapper.updateById(adv);
    }

    @Override
    public Integer getInsert(Adv adv) {
        return  this.advMapper.getInsert(adv);
    }

    @Override
    public Adv selectAllById(Integer id) {
        return  this.baseMapper.selectById(id);
    }


}

